package newcrunch.grader;

/**
 * Class to hold the submission information to relief load from the server.
 * @author ccadm
 */
public class SubmissionInfo 
{
    public String submissionId;
    public String username;
    public String firstname;
    public String dateGraded;
    public String filename;
    public String comment;
    public String grader;
    public String dateSubmitted;
    
    public SubmissionInfo(String username)
    {
        this(null, username, null, null, null, null, null, null);
    }
    
    public SubmissionInfo(String id, String username, String firstname, 
            String dateGraded, String filename, String comment, String grader,
            String dateSubmitted)
    {
        this.submissionId = id;
        this.username = username;
        this.firstname = firstname;
        this.dateGraded = dateGraded;
        this.filename = filename;
        this.comment = comment;
        this.grader = grader;
        this.dateSubmitted = dateSubmitted;
    }
    
    @Override
    public String toString()
    {
        return String.format("(%s, %s, %s, %s, %s, %s, %s, %s)", submissionId,
                username, firstname, dateGraded, filename, comment, grader,
                dateSubmitted);
    }
    
    @Override
    public int hashCode()
    {
        return username.hashCode();
    }
    
    @Override
    public boolean equals(Object info)
    {
        return info instanceof SubmissionInfo &&
                ((SubmissionInfo)info).submissionId.equals(this.submissionId);
    }
}
